/*
 * Copyright 2022-2029 heshuixing(https://gitee.com/heshuixing)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.mercury.ec.module.air.controller.admin.order.validator;

import com.mercury.ec.module.air.controller.admin.order.vo.orderroute.AirOrderRouteUpdateReqVO;
import com.mercury.ec.module.air.validator.AirGroup;
import org.hibernate.validator.spi.group.DefaultGroupSequenceProvider;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * 修改行程校验器
 *
 * @author hesx
 */
public class AirOrderRouteUpdateSequenceProvider implements DefaultGroupSequenceProvider<AirOrderRouteUpdateReqVO> {
    @Override
    public List<Class<?>> getValidationGroups(AirOrderRouteUpdateReqVO updateReqVO) {
        List<Class<?>> defaultGroupSequence = new ArrayList<>();
        defaultGroupSequence.add(AirOrderRouteUpdateReqVO.class);
        if (Objects.nonNull(updateReqVO)) {
            if (updateReqVO.getStop()) {
                defaultGroupSequence.add(AirGroup.Stop.class);
            }
        }
        return defaultGroupSequence;
    }
}
